import { innerPadding, mainPadding } from "../components/Unit";

// 根据Unit位置，计算margin-left
const getItemMarginLeft = (index: number) => {
    const column = index % 9;
    if (column == 0 || column == 3 || column == 6) {
        return mainPadding;
    } else {
        return innerPadding;
    }
}

// 根据Unit位置，计算margin-top
const getItemMarginTop = (index: number) => {
    const row = Math.floor(index / 9);
    if (row == 0 || row == 3 || row == 6) {
        return mainPadding;
    } else {
        return innerPadding;
    }
}

// 根据Unit位置，计算margin-bottom
const getItemMarginBottom = (index: number) => {
    const row = Math.floor(index / 9);
    if (row == 8) {
        return mainPadding;
    } else {
        return 0;
    }
}

// 30%概率随机
const isRandom30P = () => {
    const randomValue = Math.random();
    return randomValue < 0.3;
}

export { getItemMarginLeft, getItemMarginTop, getItemMarginBottom, isRandom30P };